Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: clean up getConnection() test properly #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alxndrsn
Copy link

This fix for balderdashy/sails#6908 will allow mocha to be updated to the latest version.

@@ -24,6 +24,10 @@ describe('Connectable ::', function() {
});
});

after(function(done) {
manager.pool.end(done);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use the mp-postgresql destroyManager method for this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you 🙂

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this more, I think the above approach is preferable to using the library under test for cleanup.

assert(report.connection.release);
// Assert that the connection has a release function, and call it to
// release the connection.
report.connection.release();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep the assert here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it add value? If report.connection.release is not defined, then this line will throw anyway.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, but I'd like to keep this PR to just the minimal set of changes needed for the fix

Copy link
Member

@rachaelshaw rachaelshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert(report.connection.release);
// Assert that the connection has a release function, and call it to
// release the connection.
report.connection.release();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So your preference would be something like below?

        // Assert that the connection has a release function
        assert(report.connection.release);

        // Call the release function on the connection to release the connection
        report.connection.release();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants